#include "form_set.h"
#include "ui_form_set.h"

Form_set::Form_set(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Form_set)
{
    ui->setupUi(this);

    QPixmap img(":/new/prefix1/pictures/表情包.jpeg");
    ui->label_img->setPixmap(img);

    connect(ui->pushButton_livingroom,SIGNAL(clicked()),this,SLOT(clickedLivingroomBtn()));
    connect(ui->pushButton_bedroom,SIGNAL(clicked()),this,SLOT(clickedBedroomBtn()));
    connect(ui->pushButton_scene,SIGNAL(clicked()),this,SLOT(clickedSceneBtn()));
    connect(ui->pushButton_set,SIGNAL(clicked()),this,SLOT(clickedSetBtn()));

    ui->pushButton_livingroom->setStyleSheet(QPushButton_STYTLE_OFF);
    ui->pushButton_bedroom->setStyleSheet(QPushButton_STYTLE_OFF);
    ui->pushButton_scene->setStyleSheet(QPushButton_STYTLE_OFF);
    ui->pushButton_set->setStyleSheet(QPushButton_STYTLE_ON);
}

void Form_set::clickedLivingroomBtn()
{
    Form_livingroom *lr = new Form_livingroom;
    ui->pushButton_livingroom->setStyleSheet(QPushButton_STYTLE_ON);
    ui->pushButton_bedroom->setStyleSheet(QPushButton_STYTLE_OFF);
    ui->pushButton_scene->setStyleSheet(QPushButton_STYTLE_OFF);
    ui->pushButton_set->setStyleSheet(QPushButton_STYTLE_OFF);
    lr->connectServer();
    this->hide();
    lr->show();
}

void Form_set::clickedBedroomBtn()
{
    Form_bedroom *br = new Form_bedroom;
    ui->pushButton_bedroom->setStyleSheet(QPushButton_STYTLE_ON);
    ui->pushButton_livingroom->setStyleSheet(QPushButton_STYTLE_OFF);
    ui->pushButton_scene->setStyleSheet(QPushButton_STYTLE_OFF);
    ui->pushButton_set->setStyleSheet(QPushButton_STYTLE_OFF);
    br->connectServer();
    this->hide();
    br->show();
}

void Form_set::clickedSceneBtn()
{
    ui->pushButton_scene->setStyleSheet(QPushButton_STYTLE_ON);
    ui->pushButton_livingroom->setStyleSheet(QPushButton_STYTLE_OFF);
    ui->pushButton_bedroom->setStyleSheet(QPushButton_STYTLE_OFF);
    ui->pushButton_set->setStyleSheet(QPushButton_STYTLE_OFF);

    Form_scene *sce = new Form_scene;
    this->hide();
    sce->show();
}

void Form_set::clickedSetBtn()
{
    ui->pushButton_set->setStyleSheet(QPushButton_STYTLE_ON);
    ui->pushButton_livingroom->setStyleSheet(QPushButton_STYTLE_OFF);
    ui->pushButton_bedroom->setStyleSheet(QPushButton_STYTLE_OFF);
    ui->pushButton_scene->setStyleSheet(QPushButton_STYTLE_OFF);
}

Form_set::~Form_set()
{
    delete ui;
}
